/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package onlineregistration;

import java.util.Scanner;

/**
 *
 * @author TQNINH
 */
public class MemberTest {
    
    
    public MemberTest() {
        
    }
    
    public static void main(String[] args) {
        boolean isEmailValid = false;
        boolean isPasswordValid = false;
        String email;
        String password;
        Scanner scan = new Scanner(System.in);
        
        System.out.println("\n\t *** Welcome to Business Weekly ***");
        System.out.println("Enter your Email Id and choose a suitable "
                + "password to receive our weekly newsletter.");
        System.out.print("Email: ");
        email = scan.next();
        System.out.println("Choose a suitable Password: \n(Should be "
                + "atleast 6 characters long and must have atleast one "
                + "upper case letter and one number.)");
        password = scan.next();
        
        if((email.length() > 0) && (password.length() > 6)) {
            Member objMember = new Member();
            isEmailValid = objMember.validateEmail(email);
            isPasswordValid = objMember.validatePassword(password);
            
            if((isEmailValid) && (isPasswordValid)) {
                System.out.println("\nYou have successfully registered with "
                        + "Bussiness Weekly!");
            } else {
                System.out.println("\nRegistration Failed! Invalid email "
                        + "address or password chosen!");
            }
        } else {
            System.out.println("\nLength of email address or password is "
                    + "insufficient!");
        }
    }
}
